package nowcoder.written_examination.contest;

import java.util.Scanner;

/**
 *
 * @author fance
 * @date 18-6-26 上午6:11
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            StringBuilder stringBuilder =
                    new StringBuilder(scanner.next());
            int n = stringBuilder.length();
            while (n > 0) {
                n -= 2;
                stringBuilder.deleteCharAt(stringBuilder.length() - 1);
                stringBuilder.deleteCharAt(stringBuilder.length() - 1);
                if (isEven(stringBuilder.toString())) {
                    break;
                }
            }
            System.out.println(stringBuilder.length());
        }
    }
    public static boolean isEven(String s) {
        if (s.length() % 2 != 0) {
            return false;
        }
        int index = s.length() / 2;
        return s.substring(0,index).equals(s.substring(index));
    }
}
    /*public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            *//*int m = scanner.nextInt();
            int[] a = new int[m];
            for (int i = 0; i < m; i++) {
                a[i] = scanner.nextInt();
            }*//*
            String s = scanner.next();
            int max = 0;
            for (int i = 0; i < s.length(); i++) {
                for (int j = i; j <= s.length(); j++) {
                    String tmp = s.substring(i,j);
                    if (isValid(tmp)) {
                        max = Math.max(max,tmp.length());
                    }
                }
            }
            System.out.println(max);
        }
    }
    public static boolean isValid(String s) {
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (c != 'A' && c != 'T' &&
            c != 'C' && c != 'G') {
                return false;
            }
        }
        return true;
    }
}
*/